<?php
@require("php_config_init.php");
@require("php_config_mysql.php");
$userid = $_GET["userid"];
//sql语句
$sql = "select c.id,c.goodsid,c.goodsnum,c.birthday_card,c.measure_id,mi.measure,mi.mount,gi.goods_name,gi.goods_smallimg,mn.goodsprice,gi.goods_type from cart c,measureinfo mi,goods_info gi,measure_num mn where c.status = 1 and mi.status = 1 and gi.status = 1 and mn.status = 1 and c.userid = '$userid' and c.measure_id = mi.id and c.goodsid = gi.goods_id and c.goodsid = mn.goodsid and c.measure_id = mn.measure_id order by id asc";
//执行sql语句
$result = mysql_query($sql);
$list = array();
//解析一行数据，没有返回false
while($item = mysql_fetch_array($result)){
    $temp = array();
    $temp["id"] = $item["id"];
    $temp["goodsid"] = $item["goodsid"];
    $temp["goodsnum"] = $item["goodsnum"];
    $temp["birthday_card"] = $item["birthday_card"];
    $temp["measure"] = $item["measure"];
    $temp["mount"] = $item["mount"];
    $temp["goods_name"] = $item["goods_name"];
    $temp["goods_smallimg"] = $item["goods_smallimg"];
    $temp["goodsprice"] = $item["goodsprice"];
    $temp["goods_type"] = $item["goods_type"];
    $temp["measure_id"] = $item["measure_id"];
    $list[] = $temp;
}
echo json_encode($list);
?>